﻿/// ****************************************************************************
/// Author:	        Robin Zhu
/// Create Date:	2012-4-18
/// Purpose: 		路由配置元素类定义文件
/// ****************************************************************************
/// Modify By		Date			Remark
/// ****************************************************************************

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace RB.Web.Mvc
{
    /// <summary>
    /// 路由配置元素类
    /// </summary>
    public class RouteConfigElement : ConfigurationElement
    {
        [ConfigurationPropertyAttribute("name", DefaultValue = "Default", IsRequired = true, IsKey = true)]
        public string Name
        {
            get
            {
                return (string)this["name"];
            }
            set
            {
                this["name"] = value;
            }
        }

        [ConfigurationPropertyAttribute("type", DefaultValue = "RB.Web.Mvc.ConfigurableRoute")]
        public string Type
        {
            get
            {
                return (string)this["type"];
            }
            set
            {
                this["type"] = value;
            }
        }

        [ConfigurationPropertyAttribute("url", DefaultValue = "{controller}/{action}/{id}", IsRequired = true)]
        public string Url
        {
            get
            {
                return (string)this["url"];
            }
            set
            {
                this["url"] = value;
            }
        }

        [ConfigurationProperty("defaultValues")]
        public RouteDefaultValueConfigCollection DefaultValues
        {
            get
            {
                if (!this.Properties.Contains("defaultValues"))
                {
                    this["defaultValues"] = new RouteDefaultValueConfigCollection();
                }
                return (RouteDefaultValueConfigCollection)this["defaultValues"];
            }
        }

        [ConfigurationPropertyAttribute("area", DefaultValue = "")]
        public string Area
        {
            get
            {
                return (string)this["area"];
            }
            set
            {
                this["area"] = value;
            }
        }

        [ConfigurationPropertyAttribute("autoTimestampParameter", DefaultValue = false)]
        public bool AutoTimestampParameter
        {
            get
            {
                return (bool)this["autoTimestampParameter"];
            }
            set
            {
                this["autoTimestampParameter"] = value;
            }
        }
    }
}
